package com.diagrammer.vo.factory
{
	import com.diagrammer.vo.LineVO;
	import com.diagrammer.vo.NodeVO;
	
	/**
	 * 默认VO对象创建工厂类
	 * 
	 * @author Dwei <b>2012-02-10</b>
	 * 
	 */	
	public class VOFactory implements IVOFactory
	{
		public function VOFactory()
		{
		}
		
		/**
		 * @inheritDoc
		 */		
		public function getNodeVO(value:XML):NodeVO
		{
			return new NodeVO();
		}
		
		/**
		 * @inheritDoc
		 */		
		public function getNodeDataProvider(value:NodeVO, nodeIdField:String):XML
		{
			var result:XML = <node/>;
			result[nodeIdField] = value.ID;
			return result;
		}
		
		/**
		 * @inheritDoc
		 */		
		public function getLineVO(value:XML):LineVO
		{
			return new LineVO();
		}
		
		/**
		 * @inheritDoc
		 */		
		public function getLineDataProvider(value:LineVO, lineIdField:String, fromIdField:String, toIdField:String):XML
		{
			var result:XML = <line/>;
			result[lineIdField] = value.ID;
			result[fromIdField] = value.fromID;
			result[toIdField] = value.toID;
			return result;
		}
	}
}